for /f &quot;tokens=* delims=&quot; %%n in ('dir &quot;%cd%&quot; /b/ad/s') do (
echo &quot;%%n&quot;
if exist &quot;%%n\.keep&quot; (del /f /s /q &quot;%%n\.keep&quot;)||(echo NotFile)
dir/a/b &quot;%%n\&quot;|findstr . &gt;nul&amp;&amp;(echo NotEmpty)||(echo.&gt;&quot;%%n\.keep&quot;)
)